package com.batchengine;

/**
 * Created by  solutions
 * Author: sunil.incubator@yahoo.com
 * Date: Aug 8, 2009
 */
public class Definitions {

    public static enum DelayParam {

        SEC("SEC"),
        MIN("MIN"),
        HR("HR");

        private String delay;

        DelayParam(String delay) {
            this.delay = delay;
        }

        @Override
        public String toString() {
            final StringBuilder sb = new StringBuilder();
            sb.append("DelayParam");
            sb.append("{delay='").append(delay).append('\'');
            sb.append('}');
            return sb.toString();
        }
    }

    public static enum TaskMode {
        READ, WRITE, READ_WRITE
    }

    public static enum DataAdapter {
        FILE, XML, DB
    }

    public static enum WorkerType {
        WORK_GATHERER, PRODUCER, CONSUMER, EXECUTER
    }

    public static enum ContextParams {
        TASK_ID, TASK_CLASS, TASK_SELECTOR, TASK_STOP_SIGNAL, TASK_TYPE, TASK_INSTANCE, ARGUMENTS, OWNER
    }

    public static enum TaskProcesingType {
        SCHEDULED, RECURRING
    }

    public static enum OperationType {
        STOP_MANAGER, STOP_POOL, STOP_WORKER,
        START_MANAGER, RESTART_POOL, START_WORKER
    }

    public static enum TaskType {

        JAVA(1), PLSQL(2), PYTHON(2), PERL(4);

        int Id;

        TaskType(int id) {
            Id = id;
        }

        public int getId() {
            return Id;
        }

        public static TaskType getType(int id) {

            switch (id) {
                case 1:
                    return JAVA;
                case 2:
                    return PLSQL;
                case 3:
                    return PYTHON;
                case 4:
                    return PERL;
                default:
                    return null;

            }
        }
    }
}
